<template>
  <div class="search">
    <f-form ref="form" :action="api.employee" :form-key="this.formItem.employeeId" >
      <f-form-item label="员工姓名"  name="employeeName" dataType="${formField.dataType}"   :value="formItem.employeeName" />
      <f-form-item label="platform平台,shop商家,third第三方"  name="employeeType" dataType="${formField.dataType}"   :value="formItem.employeeType" />
      <f-form-item label="员工头像"  name="employeeImg" dataType="${formField.dataType}"   :value="formItem.employeeImg" />
      <f-form-item label="manager区域经理，employee普通员工"  name="employeePosition" dataType="${formField.dataType}"   :value="formItem.employeePosition" />
      <f-form-item label="员工账户"  name="employeeAccount" dataType="${formField.dataType}"   :value="formItem.employeeAccount" />
      <f-form-item label="手机号"  name="employeePhone" dataType="${formField.dataType}"   :value="formItem.employeePhone" />
      <f-form-item label="员工二维码"  name="employeeQrCode" dataType="${formField.dataType}"   :value="formItem.employeeQrCode" />
      <f-form-item label="员工所属机场"  name="airportId" dataType="${formField.dataType}"   :value="formItem.airportId" />
      <f-form-item label=""  name="targetId" dataType="${formField.dataType}"   :value="formItem.targetId" />
      <f-form-item label="员工职位状态"  name="jobState" dataType="number"   :value="formItem.jobState" />
      <f-form-item label="是否调岗"  name="isAdjust" dataType="number"   :value="formItem.isAdjust" />
      <f-form-item label="企业微信图片"  name="qiyeWeChatImg" dataType="${formField.dataType}"   :value="formItem.qiyeWeChatImg" />
      <f-form-item label="创建日期"  name="createDate" dataType="${formField.dataType}"   :value="formItem.createDate" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'employeeForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          employeeId: '',
          employeeName: '',
          employeeType: '',
          employeeImg: '',
          employeePosition: '',
          employeeAccount: '',
          employeePhone: '',
          employeeQrCode: '',
          airportId: '',
          targetId: '',
          jobState: '',
          isAdjust: '',
          qiyeWeChatImg: '',
          createDate: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.employeeId) {
          let params={
              employeeId:data.employeeId
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
